package Frame;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Date;
import java.util.Locale;
import javax.swing.*;

import com.eltima.components.ui.DatePicker;

public class DareSelecter extends JFrame {//郭


    public static DatePicker getDatePicker() {//郭
        final DatePicker datepick;
        String DefaultFormat = "yyyy-MM-dd";
        Date date = new Date();
        Font font = new Font("宋体", Font.BOLD, 14);
        Dimension dimension = new Dimension(177, 24);
        int[] hilightDays = { };
        int[] disabledDays = { };
        datepick = new DatePicker(date, DefaultFormat, font, dimension);
        //datepick.setLocation(130, 80);//设置起始位置
        datepick.setHightlightdays(hilightDays, Color.red);
        datepick.setDisableddays(disabledDays);
        datepick.setLocale(Locale.CHINA);
        return datepick;
    }

    public static String ReDate(DatePicker picker){//郭
        String[] temp= picker.getValue().toString().split(" ");
        String year;
        String month="";
        String day;
        year = temp[5];
        day = temp[2];
        if(temp[1].equals("Jan")){
            month = "01";
        }
        else if(temp[1].equals("Feb")){
            month = "02";
        }
        else if(temp[1].equals("Mar")){
            month = "03";
        }
        else if(temp[1].equals("Apr")){
            month = "04";
        }
        else if(temp[1].equals("May")){
            month = "05";
        }
        else if(temp[1].equals("Jun")){
            month = "06";
        }
        else if(temp[1].equals("Jul")){
            month = "07";
        }
        else if(temp[1].equals("Aug")){
            month = "08";
        }
        else if(temp[1].equals("Sep")){
            month = "09";
        }
        else if(temp[1].equals("Oct")){
            month = "10";
        }
        else if(temp[1].equals("Nov")){
            month = "11";
        }
        else if(temp[1].equals("Dec")){
            month = "12";
        }
        return year+"-"+month+"-"+day;
    }
}